package bookstudytest.threadtest.Executor;

import bookstudytest.threadtest.implement.ThreadByRunnable;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author heng.li
 * SingleThreadExecutor 相当于 new FixedThreadPool(1);
 */
public class SingleThreadExecutorTest {

    public static void main(String[] args) {
        ExecutorService executorService = Executors.newSingleThreadExecutor();
        executorService.submit(new ThreadByRunnable());
        executorService.submit(new ThreadByRunnable());
        executorService.submit(new ThreadByRunnable());
        executorService.submit(new ThreadByRunnable());
        executorService.shutdown();
    }
}
